import java.sql.Connection;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseConnection {

	public static Connection getDBConnection(){
		
		try {
			
			//Clasa driverului(asta tre sa te uiti in jar sa vezi ce clasa ii
			
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			//Connection url  subprotocol:serverType://ip/numele bazei de date
			
			String url="jdbc:mysql://localhost/persons";
			String user="adi";
			String password="steaua";
			return DriverManager.getConnection(url, user, password);
			
			
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	
	
}